<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$arrWeb = explode(",", $_data["AllWeb"]);

$strTmp1 = "<tr>
	<td class='web-name'>{Web}</td>
	<td class='web-td'><!--u1//-->0</td>
	<td class='web-td'><!--u2//-->0</td>
	<td class='web-td'><!--u3//-->0</td>
	<td class='web-td'><!--u4//-->0</td>
	<td class='web-td'><!--u5//-->0</td>
	<td class='web-td'><!--u8//-->0</td>
	<td class='web-td'><!--u9//-->0</td>
	<td class='web-td'><!--u10//-->0</td>
	<td class='web-td'><!--other//-->0</td>
	<td class='web-td'><!--sum//-->0</td>
</tr>";


$strCon = "";
foreach($arrWeb as $strWeb){
	$arrDN = explode("@", $strWeb);
	$strDomain = $arrDN[0];

	include("/home/share/www/".$arrDN[1]."/secure/db.inc.php");
	if(!preg_match("/UTF8/i", $_blDBName))continue;

	$strTmp2 = $strTmp1;
	$other = 0;
	$sum = 0;
	$strTmp2 = str_replace("{Web}", $strDomain, $strTmp2);

	$strSQL = "SELECT `MemGroup` , count( * ) AS AA FROM `bet_Sessions` GROUP BY `MemGroup`";
	$RS = @PMA_mysql_query($strSQL, $$_Conn);
	while($Rows = PMA_mysql_fetch_object($RS)){
		if(($Rows -> MemGroup >= 1 && $Rows -> MemGroup <= 5) || ($Rows -> MemGroup >= 8 && $Rows -> MemGroup <= 10)){
			$strTmp2 = str_replace("<!--u".(string)$Rows -> MemGroup."//-->0", $Rows -> AA, $strTmp2);
			$arrU["u".$Rows -> MemGroup] += $Rows -> AA;
		}else{
			$other += $Rows -> AA;
			$arrU[other] += $Rows -> AA;
		}
		$arrU[sum] += $Rows -> AA;
		$sum += $Rows -> AA;
	}
	$strTmp2 = str_replace("<!--other//-->0", $other, $strTmp2);
	$strTmp2 = str_replace("<!--sum//-->0", $sum, $strTmp2);
	$strCon .= $strTmp2;
	@mysql_free_result($RS);
	@mysql_close($$_Conn);
}

$strTmp2 = $strTmp1;
$strTmp2 = str_replace("{Web}", "總計", $strTmp2);
foreach($arrU as $key => $val){
	$strTmp2 = str_replace("<!--".$key."//-->0", $val, $strTmp2);
}
$strCon .= $strTmp2;
?><!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> 線上人數統計 </title>
<style>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #EFFFDF;
}
td {
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #FFFFFF;
	text-align: center;
}
.showTable {
	background-color: #9DBAD8;
	border: 1px solid #056FD8;
}
.web-td {
	text-align: right;
	padding-right: 2px;
}
.web-name {
	text-align: left;
	padding-left: 2px;
}
//-->
</style>
</head>

<body>
<table  border="0" cellspacing="1" cellpadding="0" class="showTable">
<tr>
	<td width="100">網站</td>
	<td width="70">會員</td>
	<td width="70">代理</td>
	<td width="70">總代</td>
	<td width="70">股東</td>
	<td width="70">操盤</td>
	<td width="70">子代理</td>
	<td width="70">子總代</td>
	<td width="70">子股東</td>
	<td width="70">其他</td>
	<td width="70">總計</td>
</tr>
<?php print $strCon;?>
</table>
現在時間：<?php print date("Y-m-d H:i:s");?>
</body>
</html>